//Component Object
Component({
  properties: {
    myProperty:{
      type:String,
      value:'',
      observer: function(){}
    },

  },
  data: {
  },
  
  relations:{
    '../custom-li/index':{
      type:'child',
      linked:function (target){
        // 每次有custom-li被插入时执行，target是该节点实例对象，触发在该节点attached生命周期之后
        console.log('ul linked target:',target)
      },
      linkChanged:function (target){
        // 每次有custom-li被移动后执行，target是该节点实例对象，触发在该节点moved生命周期之后
        console.log('ul linkChanged target:',target)
      },
      unlinked:function (target){
        // 每次有custom-li被移除时执行，target是该节点实例对象，触发在该节点detached生命周期之后
        console.log('ul unlinked target:',target)
      }
    }
  },
  methods: {
    _getAllLi: function(){
      // 使用getRelationNodes可以获得nodes数组，包含所有已关联的custom-li，且是有序的
      var nodes = this.getRelationNodes('../custom-li/index')
      console.log('ul _getAllLi nodes:',nodes)
      setTimeout(()=>{
        nodes.forEach((node)=>{
          node.setData({
            status:'insered'
          })
        })
      })
    }
  },
  created: function(){
    console.log('ul created')
  },
  attached: function(){
    console.log('ul attached')
  },
  ready: function(){
    console.log('ul ready')
    this._getAllLi()
  }
});